//
//  UserManager.h
//  NiubilityProject
//
//  Created by Apple on 2017/11/17.
//  Copyright © 2017年 Apple. All rights reserved.
//

#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, UserLoginType){
    kUserLoginTypeUnKnow = 0,//未知
    kUserLoginTypeWeChat,//微信登录
    kUserLoginTypeQQ,///QQ登录
    kUserLoginTypeFaceBook,///FaceBook登录
    kUserLoginTypePwd,///账号登录
};
typedef void (^loginBlock)(BOOL success, NSString * des);

#define isLogin [UserManager sharedUserManager].isLogined
#define curUser [UserManager sharedUserManager].curUserInfo
#define userManager [UserManager sharedUserManager]

@interface UserManager : NSObject
SINGLETON_FOR_HEADER(UserManager)

//当前用户
@property (nonatomic, strong) UserInfo *curUserInfo;
@property (nonatomic, assign) UserLoginType loginType;
@property (nonatomic, strong) NSArray *photos;
@property (nonatomic, assign) BOOL isLogined;
// 国家列表数据
@property (nonatomic, strong) NSArray *countryDataSource;

#pragma mark - ——————— 登录相关 ————————

/**
 三方登录
 
 @param loginType 登录方式
 @param completion 回调
 */
-(void)login:(UserLoginType )loginType completion:(loginBlock)completion;

/**
 带参登录
 
 @param loginType 登录方式
 @param params 参数，手机和账号登录需要
 @param completion 回调
 */
-(void)login:(UserLoginType )loginType params:(NSDictionary *)params completion:(loginBlock)completion;

/**
 自动登录
 
 @param completion 回调
 */
-(void)autoLoginToServer:(loginBlock)completion;
-(void)connectRCloud;

/**
 退出登录
 
 @param completion 回调
 */
- (void)logout:(loginBlock)completion;
/**
 加载缓存用户数据
 
 @return 是否成功
 */
-(BOOL)loadUserInfo;

+(void)uploadImage:(NSArray *)images progress:(void(^)(CGFloat))progress respons:(void(^)(id))respons failur:(void(^)(NSError *))errorBack;
    
/**
 更新个人信息
 
 */
- (void) updataUserInfo:(loginBlock)completion;
/**
获取国家信息
 
 */
- (void)getCity:(void(^)(id,int))responseData;
@end
